<template>
	<div class="goods_two">
		<div class="goods"
			id="goods"
		>
			<ul class="goods-items">
				<li class="goods-item"
					v-for="(goods, index) in goodsList"
					@click="goDetail(goods)"
				>	
					<div class="goods-item-img">
						<img v-lazy="goods.image" 
							:key="goods.image"
						/>
						<div class="goods-img-tips" v-if="goods.fan_price" :style="{backgroundImage: 'linear-gradient(to right, rgb(79, 92, 104), rgb(42, 62, 69))',background: 'linear-gradient(to right,rgba(0,0,0,0) 0%,'+ colorMid + ' 50%,rgba(0,0,0,0) 100%)'}">
							<p>分享赚{{goods.fan_price}}</p>
						</div>
					</div>
					
					<p class="title one-line"><span class="TBimg" v-if="goods.is_tmall == 0 && type == 1"></span><span class="TMimg" v-if="goods.is_tmall == 1 && type == 1"></span><span class="PDDimg" v-if="type == 3"></span><span class="JDimg" v-if="type == 2"></span>{{goods.title}}</p>
					<div class="sale">
						<p class="oldprice">原价￥<span>{{goods.origin_price}}</span></p>
						<p>{{goods.sales_num}}人已买</p>
					</div>
					<div class="price">
						<i class="icon" :style="{backgroundImage: 'linear-gradient(to right, rgb(79, 92, 104), rgb(42, 62, 69))',background: 'linear-gradient(to right,' + colorLeft + ',' + colorRight + ')'}">券后价</i>
						<p class="coupon-price common-color" :style="{color: colorLeft}">￥<span>{{goods.coupon_price}}</span></p>
						<p class="coupon" :style="{backgroundImage: 'linear-gradient(to right, rgb(79, 92, 104), rgb(42, 62, 69))',background: 'linear-gradient(to right,' + colorLeft + ',' + colorRight + ')'}">{{goods.quan_price}}元券</p>
					</div>
				</li>
			</ul>
			<div class="goods-none"
				v-if="goodsList != undefined && goodsList.length == 0 && isLoadDom"
			>
				<img src="../assets/img/nodata.png" />
			</div>
		</div>
	</div>
</template>
<script>
	import { Toast } from 'mint-ui'
	import axios from 'axios'
	import Http from '../http.js'
	export default{
		props: {
			goodsList: {
				type: Array
			},
			proType: {
				type: String
			}
		},
		data(){
			return{
				type: this.proType,
				isLoadDom: false,
				colorLeft: window.localStorage.getItem("left"), 
				colorMid: window.localStorage.getItem("mid"), 
				colorRight: window.localStorage.getItem("right"), 
			}
		},
		mounted(){

		},
		updated(){
			this.isLoadDom = true;
		},
		methods: {
			goDetail: function(goods){
				if ( goods.is_tmall == 1 && this.proType == 1) {
					this.type = 1;
					this.$router.push({
						path: '/product/detail/' + goods.origin_id,
						query: {
							type: this.type,
	                        is_collect: goods.is_collect,
	                        image: goods.image,
	                        title: goods.title,
	                        coupon_price: goods.coupon_price,
	                        origin_price: goods.origin_price,
	                        quan_price: goods.quan_price,
	                        sub_title: goods.sub_title,
	                        quan_time: goods.quan_time,
						}
					})					
				} else if ( goods.is_tmall == 0  && this.proType == 1){
					this.type = 2;
					this.$router.push({
						path: '/product/detail/' + goods.origin_id,
						query: {
							type: this.type,
	                        is_collect: goods.is_collect,
	                        image: goods.image,
	                        title: goods.title,
	                        coupon_price: goods.coupon_price,
	                        origin_price: goods.origin_price,
	                        quan_price: goods.quan_price,
	                        sub_title: goods.sub_title,
	                        quan_time: goods.quan_time,
						}
					})
				}else if (this.proType == 2) {
            		this.$router.push({
						path: '/product/detail/' + goods.origin_id,
						query: {
							type: 3,
	                        is_collect: goods.is_collect,
	                        image: goods.image,
	                        title: goods.title,
	                        coupon_price: goods.coupon_price,
	                        origin_price: goods.origin_price,
	                        quan_price: goods.quan_price,
	                        quan_time: goods.quan_time,
						}
					})
            	}else if(this.proType == 3){
            		this.$router.push({
						path: '/product/detail/' + goods.origin_id,
						query: {
							type: 4,
	                        is_collect: goods.is_collect,
	                        image: goods.image,
	                        title: goods.title,
	                        coupon_price: goods.coupon_price,
	                        origin_price: goods.origin_price,
	                        quan_price: goods.quan_price,
	                        quan_time: goods.quan_time,
						}
					})
            	}				
			},
		}
	}
</script>
<style lang="scss" scoped>
	.goods_two{
		@import '../assets/common/goods_two.scss'
	}
</style>